package com.collabscm.md.base.service.impl;

import com.collabscm.md.base.model.Parameter;
import com.collabscm.md.base.service.ParameterService;
import com.collabscm.pf.CommonConstants;
import com.collabscm.pf.dao.DatabaseDao;
import com.collabscm.pf.dao.support.DomainDaoFactory;
import com.collabscm.pf.service.support.DomainServiceSupport;
import com.collabscm.pf.util.ObjectUtils;

/**
 * 参数维护的Service实现类
 *
 * @author Zeng Raoxing
 */
public class ParameterServiceImpl extends DomainServiceSupport<Parameter, Integer> 
                                  implements ParameterService {
	private static final long serialVersionUID = 1L;

	private DatabaseDao<Parameter, Integer> parameterDao = DomainDaoFactory.createGenericDao(Parameter.class);
	
	@Override
	protected DatabaseDao<Parameter, Integer> getDatabaseDao() {
		return parameterDao;
	}

	/**
	 * 参数不能直接删除，只能修改其状态字段
	 */
	@Override
	public void delete(Parameter parameter) {
		if(CommonConstants.STATUS_ENABLE.equals(parameter.getStatus())) {
			ObjectUtils.fillUpdateInfo(parameter, true);
		}
		this.update(parameter);
	}

	/**
	 * 参数不能直接删除，只能修改其状态字段
	 */
	@Override
	public void deleteById(Integer id) {
		
	}

}
